---
import '../styles/global.css';
import BaseLayout from "../layouts/BaseLayout.astro";
import BlogPost from "../components/BlogPost.astro";
import {getCollection} from "astro:content";

const allPosts = await getCollection('posts');
const pageTitle = "我的 Astro 学习博客"
---
<BaseLayout pageTitle={pageTitle}>
    <p>在这里，我将分享我的学习 Astro 的之旅。</p>
    <ul>
        {allPosts.map(post =>
                <BlogPost url={`/posts/${post.slug}`} title={post.data.title}></BlogPost>
        )
        }
    </ul>
</BaseLayout>